#include "statusindicatorwidget.h"
#include "ui_statusindicatorwidget.h"
#include <QStyleOption>
#include <QPainter>

StatusIndicatorWidget::StatusIndicatorWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::StatusIndicatorWidget)
{
    ui->setupUi(this);
}

StatusIndicatorWidget::~StatusIndicatorWidget()
{
    delete ui;
}

void StatusIndicatorWidget::setStyle(int styleId)
{
    if(styleId == 0)
    {

    }
    else if(styleId == 1)
    {
        ui->label_offline->setStyleSheet("border-image: url(:/MyParts/images/GunOffline.png);");
        ui->label_online->setStyleSheet("border-image: url(:/MyParts/images/GunNormal.png);");
        ui->label_fueling->setStyleSheet("border-image: url(:/MyParts/images/GunFuel.png);");
        ui->label_prewarning->setStyleSheet("border-image: url(:/MyParts/images/GunPreWarning.png);");
        ui->label_warning->setStyleSheet("border-image: url(:/MyParts/images/GunWarning.png);");
    }
    else
    {

    }
}

void StatusIndicatorWidget::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event)

    QStyleOption opt;
    opt.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
